﻿<%@ Page Language="C#" MasterPageFile="~/Admin/admin.master" AutoEventWireup="true"
    CodeFile="Grn.aspx.cs" Inherits="Admin_Grn" Title="Grn List" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    Grn List</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <data:GridViewSearchPanel ID="GridViewSearchPanel1" runat="server" GridViewControlID="GridView1"
        PersistenceMethod="Session" />
    <br />
    <data:EntityGridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
        DataSourceID="GrnDataSource" DataKeyNames="GrnId" AllowMultiColumnSorting="false"
        DefaultSortColumnName="GrnId" DefaultSortDirection="Descending" ExcelExportFileName="Export_Grn.xls"
        AllowPaging="True" AllowExportToExcel="True" OnRowCommand="GridView1_RowCommand">
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="GrnId" HeaderText="Grn Id" SortExpression="[GRNId]" ReadOnly="True" />
            <asp:BoundField DataField="GrnDate" DataFormatString="{0:d}" HtmlEncode="False"
                HeaderText="Grn Date" SortExpression="[GRNDate]" />
            <asp:BoundField DataField="PoId" HeaderText="Po Id" SortExpression="[POId]" />
            <data:HyperLinkField HeaderText="Supplier Id" DataNavigateUrlFormatString="SupplierEdit.aspx?SupplierId={0}"
                DataNavigateUrlFields="SupplierId" DataContainer="SupplierIdSource" DataTextField="SupplierName" />
            <asp:BoundField DataField="PreparedBy" HeaderText="Prepared By" SortExpression="[PreparedBy]" />
            <asp:BoundField DataField="Amount" HeaderText="Amount" SortExpression="[Amount]"
                DataFormatString="{0:#,##0}">
                <ItemStyle HorizontalAlign="Right"/>
            </asp:BoundField>
            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="[Remark]" />
            <data:BoundRadioButtonField DataField="IsComplete" HeaderText="Is Complete" SortExpression="[IsComplete]" />
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:ImageButton ID="btn_Delete" runat="server" CommandName="CustomDelete" CommandArgument='<%#Eval("GRNId") %>'
                        Enabled='<%#!(Boolean)Eval("IsComplete")%>' ImageUrl="~/Admin/resources/images/icons/cross_circle.png"
                        OnClientClick="return confirm('Are you sure want to delete?');" />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <b>No Grn Found!</b>
        </EmptyDataTemplate>
    </data:EntityGridView>
    <br />
    <asp:Button runat="server" ID="btnGrn" OnClientClick="javascript:location.href='GrnEdit.aspx'; return false;"
        Text="Add New"></asp:Button>
    <data:GrnDataSource ID="GrnDataSource" runat="server" SelectMethod="GetPaged" EnablePaging="True"
        EnableSorting="True" EnableDeepLoad="True" OnSelecting="GrnDataSource_Selecting">
        <DeepLoadProperties Method="IncludeChildren" Recursive="False">
            <Types>
                <data:GrnProperty Name="Supplier" />
                <data:GrnProperty Name="WebUser" />
                <%--<data:GrnProperty Name="GrnDetailsCollection" />--%>
                <%--<data:GrnProperty Name="GrnVoid" />--%>
            </Types>
        </DeepLoadProperties>
        <Parameters>
            <data:CustomParameter Name="WhereClause" Value="" ConvertEmptyStringToNull="false" />
            <data:CustomParameter Name="OrderByClause" Value="GRNId DESC" ConvertEmptyStringToNull="false" />
            <asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex"
                Type="Int32" />
            <asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize"
                Type="Int32" />
            <data:CustomParameter Name="RecordCount" Value="0" Type="Int32" />
        </Parameters>
    </data:GrnDataSource>
</asp:Content>
